Skip to content

fix(buy): surface order-creation errors and clarify payout wallet vs method - #2532

Draft
BullishNode wants to merge 1 commit into
mainfrom
fix/buy-flow-ux
Draft

fix(buy): surface order-creation errors and clarify payout wallet vs method#2532
BullishNode wants to merge 1 commit into
mainfrom
fix/buy-flow-ux

Conversation

@BullishNode

Copy link
Copy Markdown
Contributor

⚠️ Requires emulator/device review before merge — draft until verified. Test: buy dropdown shows the network suffix on default wallets; confirmation page shows Payout wallet + Payout method rows; success page shows "You bought X sats with Y [fiat]"; entering a below-minimum amount and tapping Continue shows an error instead of doing nothing.

Problems

  1. Below-minimum (and most other) order-creation failures were invisible: the amount screen rendered only two specific error types, the datasource error parsing fell through to a null cast on unrecognized payloads, and when a limit was parsed its fiat amount was converted with btcToSats (a 20 CAD minimum rendered as 2,000,000,000 sats).
  2. The "select wallet" dropdown didn't say which network each default wallet pays out on.
  3. The confirmation page's "Payout method" row actually showed the wallet name.
  4. The success page omitted what was paid.

Changes

  • Buy dropdown: default wallets get "(L-BTC on Liquid)" / "(BTC on Bitcoin chain)" suffixes, composed locally — the shared displayLabel/global ARB keys used by 24 other call sites are untouched
  • Confirm page: split into Payout wallet and Payout method rows, sharing the network phrases with the dropdown
  • Success: "You bought {amount} with {fiatAmount}" from the order's payin side
  • Order-creation error parsing made total via a shared Never-typed helper across buy/sell/pay/withdraw; parses the server's singular reason and new plural reasons shapes (SatoshiPortal/API-Orders#865), tolerating empty and limit-less entries
  • Limit errors carry (amount, currency) verbatim; render site formats fiat as fiat
  • Any other BuyError renders through a neutral fallback message — Continue is never silently dead
  • Repairs broken translations on touched keys (zh/fa/th/tr)

Validation

10 new datasource parsing tests (all server error shapes incl. empty/mixed/null); analyze + gen-l10n clean across 27 locales; reviewed with a verification pass (wording + zh fixes applied). Full "minimum is X" copy for multi-option rejections additionally needs API-Orders#865 deployed; the app degrades gracefully without it.

Closes #2515
Closes #2516
Closes #2517
Closes #2518

…method

- Show the network on default wallets in the buy dropdown: Instant
  payments (L-BTC on Liquid) / Secure Bitcoin (BTC on Bitcoin chain).
  External and custom wallets keep their own names.
- Split the confirm page's Payout method row into Payout wallet and
  Payout method, sharing the network phrases with the dropdown.
- Success message now includes what was paid: 'You bought {amount}
  with {fiatAmount}' from the order's payin side.
- Below-minimum (and any other) order-creation failures are no longer
  silent: the amount screen renders limit errors with the server's
  amount and currency, and everything else through a neutral fallback
  message. Previously only below-min/above-max variants rendered, and
  most server errors never mapped to them, leaving Continue dead.
- Make the createOrder error parsing total via a shared Never-typed
  helper across buy, sell, pay and withdraw: an error response can no
  longer fall through to the result cast. Parses the server's singular
  reason and new plural reasons shapes (API-Orders#859), tolerating
  empty and limit-less entries.
- Stop converting fiat limit amounts with btcToSats: a 20 CAD minimum
  rendered as 2,000,000,000 sats. Error entities now carry amount and
  currency verbatim; the render site formats fiat as fiat.
- Repair broken translations the changed keys touched (zh/fa/th/tr
  buyYouBought, zh payout-method and external-wallet strings).

Closes #2515
Closes #2516
Closes #2517
Closes #2518
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants